function ajax(method,url,data,callback){
	var xhr = null;
	if(XMLHttpRequest){
		xhr = new XMLHttpRequest();
	}else{
		xhr = new ActiveXObject('Microsoft.XMLHTTP');//IE5,IE6
	}
	//打开连接
	xhr.open(method,url);
	//判断method是否post
	if(method.toLowerCase() === 'post'){
		//对于post请求需要设置请求头
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	}
	//发送请求
	xhr.send();
	//设置当请求状态发生改变时触发回调函数
	xhr.onreadystatechange=function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			var data = xhr.responseText;
			callback(data);
		}
	}
	
}